home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / PInterfaces / CursorDevices.p < prev    next >
Text File  |  1996-05-01  |  7KB  |  201 lines

  1. {
  2.      File:        CursorDevices.p
  3.  
  4.      Contains:    Cursor Devices (mouse/trackball/etc) Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT CursorDevices;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __CURSORDEVICES__}
  28. {$SETC __CURSORDEVICES__ := 1}
  29.  
  30. {$I+}
  31. {$SETC CursorDevicesIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __TYPES__}
  35. {$I Types.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED __MIXEDMODE__}
  38. {$I MixedMode.p}
  39. {$ENDC}
  40.  
  41. {$PUSH}
  42. {$ALIGN MAC68K}
  43. {$LibExport+}
  44.  
  45. {
  46.                        * * *  W A R N I N G  * * * 
  47.  
  48.     On currently shipping PowerMacs, the CursorDevices manager is implemented
  49.     in 68K code and emulated.  Unfortunately, the MixedMode glue in InterfaceLib
  50.     is incorrect.  It and the 1.0 version of this file had incorrect parameter
  51.     lists for most functions.
  52.     
  53.     As a first step to avoid runtime errors, the functions in this file were 
  54.     renamed (e.g. from"CrsrDevButtons" to "CursorDeviceButtons").  This will result
  55.     in a link time error if a PowerPC application tries to call the functions.
  56.     When InterfaceLib is fixed, the new names will be exported and PowerPC
  57.     code will then be able to call them.
  58.     
  59. }
  60. {$IFC FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE }
  61.  
  62. TYPE
  63.     ButtonOpcode                        = INTEGER;
  64. {  ButtonOpcodes  }
  65.  
  66. CONST
  67.     kButtonNoOp                    = 0;                            {  No action for this button  }
  68.     kButtonSingleClick            = 1;                            {  Normal mouse button  }
  69.     kButtonDoubleClick            = 2;                            {  Click-release-click when pressed  }
  70.     kButtonClickLock            = 3;                            {  Click on press, release on next press  }
  71.  
  72.     kButtonCustom                = 6;                            {  Custom behavior, data = CursorDeviceCustomButtonUPP  }
  73.  
  74. {  Device Classes  }
  75.     kDeviceClassAbsolute        = 0;                            {  a flat-response device  }
  76.     kDeviceClassMouse            = 1;                            {  mechanical or optical mouse  }
  77.     kDeviceClassTrackball        = 2;                            {  trackball  }
  78.  
  79.     kDeviceClass3D                = 6;                            {  a 3D pointing device  }
  80.  
  81. {  Structures used in Cursor Device Manager calls  }
  82.  
  83. TYPE
  84.     CursorDataPtr = ^CursorData;
  85.     CursorData = RECORD
  86.         nextCursorData:            CursorDataPtr;                            {  next in global list  }
  87.         displayInfo:            Ptr;                                    {  unused (reserved for future)  }
  88.         whereX:                    Fixed;                                    {  horizontal position  }
  89.         whereY:                    Fixed;                                    {  vertical position  }
  90.         where:                    Point;                                    {  the pixel position  }
  91.         isAbs:                    BOOLEAN;                                {  has been stuffed with absolute coords  }
  92.         buttonCount:            SInt8;                                    {  number of buttons currently pressed  }
  93.         screenRes:                LONGINT;                                {  pixels per inch on the current display  }
  94.         privateFields:            ARRAY [0..21] OF INTEGER;                {  fields use internally by CDM  }
  95.     END;
  96.  
  97.     CursorDevicePtr = ^CursorDevice;
  98.     CursorDevice = RECORD
  99.         nextCursorDevice:        CursorDevicePtr;                        {  pointer to next record in linked list  }
  100.         whichCursor:            CursorDataPtr;                            {  pointer to data for target cursor  }
  101.         refCon:                    LONGINT;                                {  application-defined  }
  102.         unused:                    LONGINT;                                {  reserved for future  }
  103.         devID:                    OSType;                                    {  device identifier (from ADB reg 1)  }
  104.         resolution:                Fixed;                                    {  units/inch (orig. from ADB reg 1)  }
  105.         devClass:                SInt8;                                    {  device class (from ADB reg 1)  }
  106.         cntButtons:                SInt8;                                    {  number of buttons (from ADB reg 1)  }
  107.         filler1:                SInt8;                                    {  reserved for future  }
  108.         buttons:                SInt8;                                    {  state of all buttons  }
  109.         buttonOp:                PACKED ARRAY [0..7] OF UInt8;            {  action performed per button  }
  110.         buttonTicks:            ARRAY [0..7] OF LONGINT;                {  ticks when button last went up (for debounce)  }
  111.         buttonData:                ARRAY [0..7] OF LONGINT;                {  data for the button operation  }
  112.         doubleClickTime:        LONGINT;                                {  device-specific double click speed  }
  113.         acceleration:            Fixed;                                    {  current acceleration  }
  114.         privateFields:            ARRAY [0..14] OF INTEGER;                {  fields used internally to CDM  }
  115.     END;
  116.  
  117. {  for use with CursorDeviceButtonOp when opcode = kButtonCustom  }
  118.     CursorDeviceCustomButtonProcPtr = Register68kProcPtr;  { PROCEDURE CursorDeviceCustomButton(ourDevice: CursorDevicePtr; button: INTEGER); }
  119.  
  120.     CursorDeviceCustomButtonUPP = UniversalProcPtr;
  121.  
  122. CONST
  123.     uppCursorDeviceCustomButtonProcInfo = $000ED802;
  124.  
  125. FUNCTION NewCursorDeviceCustomButtonProc(userRoutine: CursorDeviceCustomButtonProcPtr): CursorDeviceCustomButtonUPP;
  126.     {$IFC NOT GENERATINGCFM }
  127.     INLINE $2E9F;
  128.     {$ENDC}
  129.  
  130. PROCEDURE CallCursorDeviceCustomButtonProc(ourDevice: CursorDevicePtr; button: INTEGER; userRoutine: CursorDeviceCustomButtonUPP);
  131.     {$IFC NOT GENERATINGCFM}
  132.     {To be implemented:  Glue to move parameters into registers.}
  133.     {$ENDC}
  134. FUNCTION CursorDeviceMove(ourDevice: CursorDevicePtr; deltaX: LONGINT; deltaY: LONGINT): OSErr;
  135.     {$IFC NOT GENERATINGCFM}
  136.     INLINE $7000, $AADB;
  137.     {$ENDC}
  138. FUNCTION CursorDeviceMoveTo(ourDevice: CursorDevicePtr; absX: LONGINT; absY: LONGINT): OSErr;
  139.     {$IFC NOT GENERATINGCFM}
  140.     INLINE $7001, $AADB;
  141.     {$ENDC}
  142. FUNCTION CursorDeviceFlush(ourDevice: CursorDevicePtr): OSErr;
  143.     {$IFC NOT GENERATINGCFM}
  144.     INLINE $7002, $AADB;
  145.     {$ENDC}
  146. FUNCTION CursorDeviceButtons(ourDevice: CursorDevicePtr; buttons: INTEGER): OSErr;
  147.     {$IFC NOT GENERATINGCFM}
  148.     INLINE $7003, $AADB;
  149.     {$ENDC}
  150. FUNCTION CursorDeviceButtonDown(ourDevice: CursorDevicePtr): OSErr;
  151.     {$IFC NOT GENERATINGCFM}
  152.     INLINE $7004, $AADB;
  153.     {$ENDC}
  154. FUNCTION CursorDeviceButtonUp(ourDevice: CursorDevicePtr): OSErr;
  155.     {$IFC NOT GENERATINGCFM}
  156.     INLINE $7005, $AADB;
  157.     {$ENDC}
  158. FUNCTION CursorDeviceButtonOp(ourDevice: CursorDevicePtr; buttonNumber: INTEGER; opcode: ButtonOpcode; data: LONGINT): OSErr;
  159.     {$IFC NOT GENERATINGCFM}
  160.     INLINE $7006, $AADB;
  161.     {$ENDC}
  162. FUNCTION CursorDeviceSetButtons(ourDevice: CursorDevicePtr; numberOfButtons: INTEGER): OSErr;
  163.     {$IFC NOT GENERATINGCFM}
  164.     INLINE $7007, $AADB;
  165.     {$ENDC}
  166. FUNCTION CursorDeviceSetAcceleration(ourDevice: CursorDevicePtr; acceleration: Fixed): OSErr;
  167.     {$IFC NOT GENERATINGCFM}
  168.     INLINE $7008, $AADB;
  169.     {$ENDC}
  170. FUNCTION CursorDeviceDoubleTime(ourDevice: CursorDevicePtr; durationTicks: LONGINT): OSErr;
  171.     {$IFC NOT GENERATINGCFM}
  172.     INLINE $7009, $AADB;
  173.     {$ENDC}
  174. FUNCTION CursorDeviceUnitsPerInch(ourDevice: CursorDevicePtr; resolution: Fixed): OSErr;
  175.     {$IFC NOT GENERATINGCFM}
  176.     INLINE $700A, $AADB;
  177.     {$ENDC}
  178. FUNCTION CursorDeviceNextDevice(VAR ourDevice: CursorDevicePtr): OSErr;
  179.     {$IFC NOT GENERATINGCFM}
  180.     INLINE $700B, $AADB;
  181.     {$ENDC}
  182. FUNCTION CursorDeviceNewDevice(VAR ourDevice: CursorDevicePtr): OSErr;
  183.     {$IFC NOT GENERATINGCFM}
  184.     INLINE $700C, $AADB;
  185.     {$ENDC}
  186. FUNCTION CursorDeviceDisposeDevice(ourDevice: CursorDevicePtr): OSErr;
  187.     {$IFC NOT GENERATINGCFM}
  188.     INLINE $700D, $AADB;
  189.     {$ENDC}
  190. {$ENDC}
  191. {$ALIGN RESET}
  192. {$POP}
  193.  
  194. {$SETC UsingIncludes := CursorDevicesIncludes}
  195.  
  196. {$ENDC} {__CURSORDEVICES__}
  197.  
  198. {$IFC NOT UsingIncludes}
  199.  END.
  200. {$ENDC}
  201.